home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 201-225 / disk_214 / memdiag / md.doc < prev    next >
Text File  |  1992-05-06  |  7KB  |  156 lines

  1. MD--Memory Diagnostic
  2.  
  3. SYNOPSIS: (CLI environment)
  4.  
  5.      stack 10000
  6.      MD [>reportfile] [-qaddressfile]
  7.  
  8.  
  9. DESCRIPTION:
  10.  
  11.      MD is a memory diagnostic program.  It tests your system's memory and
  12. reports any addresses where errors occur.  A memory error occurs when the
  13. value read from an address is not the value which was stored there.
  14.  
  15.      MD runs from the Command Line Interface (CLI).  It requires a stack
  16. size of 10000 bytes.  It writes its report to standard output.  It also
  17. sends status messages to standard error. If you want to save the report for
  18. later review (and separate it from the status messages) redirect standard
  19. output to a file (for example, "MD >MD.rpt").
  20.  
  21.  
  22. COMMAND LINE OPTIONS:
  23.  
  24.      The "-q" option builds a file of bad addresses for use by MQ, the
  25. memory quarantine program.  Specify the filename to which you want the
  26. addresses written immediately after the q without a space.  The file will
  27. contain a list of addresses where MD found an error.
  28.  
  29.      If you suspect intermittent memory problems you should run MD
  30. repeatedly, saving the output to different files.  By comparing several
  31. reports you can identify addresses which fail occasionally.  The quarantine
  32. files MD produces are ASCII characters so you can edit them as necessary to
  33. build a complete list of defective addresses.
  34.  
  35.      MD tests memory by comparing values read from an address with a known
  36. value previously written to that address.  It does not interfere with other
  37. tasks in the system (except by soaking up memory which they might need).  It
  38. sends its report to standard output so it can be redirected to a disk file
  39. or printer.
  40.  
  41.  
  42. INPUT:
  43.  
  44.      MD does not read external data.
  45.  
  46.  
  47. OUTPUT:
  48.  
  49.      The diagnostic report begins with a header identifying the program,
  50. author, and version, and the time of the test.  Next it lists the blocks of
  51. memory it examined.  The listing gives the block's number, address (in
  52. hexadecimal notation), and size (in decimal).  Errors are listed as they are
  53. encountered, one to a line.  The line identifies the address where the error
  54. occurred, the value found at that address, and the value MD expected to
  55. find.  All values are hexadecimal.  For example:
  56.  
  57.           ERROR! Address:   21646C  found: 20  expected:  0
  58.  
  59. At the end of the report MD records the number of errors it found.
  60.  
  61.      As MD executes it displays status messages.  The messages advise the
  62. user MD is allocating blocks, sorting them, initializing blocks, and testing
  63. them.  They identify the block number and its size as well as the value used
  64. to initialize or test it.
  65.  
  66.      If the -q option is specified on the command line MD will list all the
  67. addresses where memory errors occurred to the specified file.  The addresses
  68. are expressed as ASCII characters representing hexadecimal values.  Each
  69. address is on a separate line.  The addresses are sorted in ascending order
  70. and there are no duplicates.
  71.  
  72.  
  73. EXECUTION:
  74.  
  75.      MD takes about 8 minutes to test a 2.5MB machine.  During that time
  76. there will not be enough memory left to run other jobs.  When MD finishes,
  77. however, it will release all the memory it used and other jobs can resume
  78. without rebooting.  MD will not interfere with other jobs that are executing
  79. when it is invoked but it is possible to create a deadlock if there are
  80. other active jobs in the system.  Besides that, MD cannot test memory that
  81. is allocated to another process.  Consequently, it is best to run MD
  82. immediately after booting the system.
  83.  
  84.      The recommended way to run MD is to create a special Workbench boot
  85. disk with at least 200 free blocks.  Deleting the Utilities directory will
  86. free that much space from a standard Workbench disk.  Copy MD to the disk. 
  87. Change the Startup-Sequence file in the s directory to set the stack size to
  88. 10000.  After booting with this disk use the date command to set the date
  89. and time if necessary.  Then you can execute MD as many times as you wish,
  90. directing the output to a different file each time.  By examining the
  91. reports you can identify the addresses where memory errors occurred.
  92.  
  93.  
  94. PROGRAM LOGIC:
  95.  
  96.      MD is quite simple.  It allocates all the memory the system will give
  97. it.  Then it writes a value into each address.  It compares the value it
  98. reads back with the one it wrote and if they're different it records the
  99. error.
  100.  
  101.      The algorithm for allocating memory is straightforward.  MD begins by
  102. requesting a 1MB block of memory.  Each time its request is successful it
  103. repeats it.  When the request fails MD cuts its block size in half and tries
  104. again.  The iteration ends when MD can't get any 1-byte blocks.
  105.  
  106.      MD sorts the blocks into ascending order so the report it produces will
  107. be a little easier to follow.  That's purely a cosmetic feature to make the
  108. user more comfortable.  (Remember, I was the user for whom it was written
  109. and ordered lists make more sense to me.)
  110.  
  111.      MD tests memory with four values.  They are 0, 0xff, 0x55, and 0xaa.
  112. The test begins by initializing all the bytes in each block to 0.  Next the
  113. contents of each byte are compared to 0.  If the values don't match MD
  114. reports the error.  It stores the next test value at that address and moves
  115. on.  When all the memory has been checked for the first value and loaded
  116. with the next value MD makes a second pass through all the memory.  A third
  117. pass checks for 0x55 and loads 0xaa.  The final pass looks for 0xaa in each
  118. byte.
  119.  
  120.      At first glance it seems less efficient to make so many passes through
  121. memory.  Why not test all four values at each byte before moving on to the
  122. next address?  There are two reasons.  Had the program been written
  123. something like this:
  124.  
  125.           char *address;
  126.           for (address = start; address < end; address++)
  127.           {
  128.                *address = 0;
  129.                if (*address != 0)
  130.                     printf("ERROR! ...");
  131.                *address = 0xff;
  132.                if (*address != 0xff)
  133.                     printf("ERROR! ...");
  134.           }
  135.  
  136. the compiler might outsmart you.  It could see that nothing is done with
  137. *address so it might keep it in a register to speed up the program.  It
  138. would be fast, all right, but it wouldn't tell you anything.
  139.  
  140.      The second reason is to allow time for memory errors to occur.  The
  141. approach I used reduces the possibility that an address might hold the
  142. correct value briefly but lose it after some time has passed.  I don't know
  143. how probable that is.  It seemed a good idea to prevent it anyway.
  144.  
  145.      After all the blocks have been tested MD returns them to the system's
  146. memory free list.
  147.  
  148.      Send questions, comments, or bug reports to:
  149.  
  150. --Fabbian Dufoe
  151.   350 Ling-A-Mor Terrace South
  152.   St. Petersburg, Florida  33705
  153.   813-823-2350
  154.  
  155. UUCP: ...uunet!pdn!jc3b21!fgd3
  156.